/*
  Inline Labels Editor
  ------------------------------------------------------------------------------
*/

$inline-labels--popover-caret: 12px;

.inline-labels--editor {
  min-height: 18px;
  position: relative;
  display: flex;
  align-items: center;
}

.inline-labels--popover {
  position: absolute;
  top: calc(100% + #{$inline-labels--popover-caret - $ix-marg-a});
  left: $inline-labels--popover-caret * -2;
  width: 320px;
  background-color: $g5-pepper;
  padding: $ix-marg-c;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  border-radius: $radius;
  @extend %drop-shadow;
  z-index: 1000;

  &:after {
    content: '';
    border: $inline-labels--popover-caret solid transparent;
    border-bottom-color: $g5-pepper;
    position: absolute;
    top: 0;
    left: ($inline-labels--popover-caret * 3) - $ix-border;
    transform: translate(-50%, -100%);
  }
}

.inline-labels--popover-heading {
  margin-top: 0;
  user-select: none;
  text-align: center;
  color: $g13-mist;
  margin-bottom: $ix-marg-c;
}

.inline-labels--list-container {
  background-color: $g3-castle;
  border-radius: $radius;
  margin-top: $ix-marg-a;
  overflow: hidden;
}

.inline-labels--list {
  display: flex;
  width: 100%;
  flex-direction: column;
  align-items: stretch;
}

.inline-labels--list-item {
  display: flex;
  align-items: flex-start;
  padding: $ix-marg-a $ix-marg-b;

  &.active {
    background-color: $c-pool;
  }

  &.active,
  &:hover {
    cursor: pointer;
  }
}

.inline-labels--create-new {
  min-height: 26px;
  font-size: 13px;
  font-weight: 500;
  color: $g11-sidewalk;
  transition: background-color 0.25s ease, color 0.25s ease;
  word-break: break-all;
  word-wrap: break-word;

  strong {
    font-weight: 900;
    color: $g15-platinum;
  }

  &.active {
    color: $c-neutrino;

    strong {
      color: $g20-white;
    }
  }
}

.inline-labels--empty {
  width: 100%;
  font-size: 13px;
  font-weight: 500;
  user-select: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: $g9-mountain;
  font-style: italic;
  min-height: 30px;
  line-height: 30px;

  &:first-child {
    margin-bottom: $ix-marg-b - ($ix-border / 2);
  }
}

.inline-labels--selection {
  display: flex;
  flex-wrap: nowrap;
  margin-bottom: $ix-marg-c;
}

.inline-labels--remove-all {
  margin-top: $ix-marg-b;
  margin-left: $ix-marg-b;
}

.inline-labels--selected,
.inline-labels--none-selected {
  flex: 1 0 0;
  margin-top: $ix-marg-b;
}

.inline-labels--none-selected {
  font-size: 13px;
  color: $g10-wolf;
  font-weight: 500;
  font-style: italic;
  user-select: none;
}

/*
Round button for opening popover
------------------------------------------------------------------------------
*/

$label-margin: 1px;
$label-edit-button-diameter: 18px; // Should be the same as the height of labels

.inline-labels--add {
  width: $label-edit-button-diameter;
  height: $label-edit-button-diameter;
  margin: $label-margin;
  position: relative;
  transition: opacity 0.25s ease;

  &:before,
  &:after {
    content: '';
    pointer-events: none;
    background-color: $g20-white;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 3;
    transition: width 0.25s ease;
    height: $ix-border;
    width: $label-edit-button-diameter - $ix-marg-b;
    border-radius: $ix-border / 2;
  }

  &:after {
    transform: translate(-50%, -50%) rotate(90deg);
  }

  > .button.button-sm {
    position: absolute;
    z-index: 2;
    top: 50%;
    left: 50%;
    width: $label-edit-button-diameter;
    height: $label-edit-button-diameter;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    color: transparent;
    transition: background-color 0.25s ease, border-color 0.25s ease,
      box-shadow 0.25s ease, height 0.25s ease, width 0.25s ease;

    > .button-icon {
      font-size: $form-sm-font;
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
    }
  }

  &:hover > .button.button-sm {
    width: $form-sm-height - $ix-marg-a;
    height: $form-sm-height - $ix-marg-a;
  }

  &:hover:before,
  &:hover:after {
    width: $form-sm-height - $ix-marg-c;
  }
}
